package pl.ydp.components.mathcell.mathrecognizer.engine.database.modelsets.math_basic.characters
{
	import pl.ydp.components.mathcell.mathrecognizer.characters.Character;
	import pl.ydp.components.mathcell.mathrecognizer.geometry.classification.PrimitiveType;
	import pl.ydp.components.mathcell.mathrecognizer.model.PrimitivesRelation;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescription;
	import pl.ydp.components.mathcell.mathrecognizer.model.RelationDescriptorType;
	import pl.ydp.components.mathcell.mathrecognizer.model.ShapeModel;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ConnectionsDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.LocationDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.ObjectDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.descriptors.SizeDescriptor;
	import pl.ydp.components.mathcell.mathrecognizer.model.presets.PrimitivePresets;
	
	public class MB_ch_6
	{
		public static const MODELS_COUNT:Number = 1;
		
		//---------------------------------------------------
		
		public static function getModels():Array{
			
			var sixShapeModels:Array = new Array();
			
			sixShapeModels.push(getModel0());
			sixShapeModels.push(getModel1());
			sixShapeModels.push(getModel2());		
			
			return sixShapeModels;
		}
		
		//---------------------------------------------------
		
		private static function getModel0():ShapeModel{
			var six:ShapeModel;
			var name:String = "MB_6_STD";
			var six_prim:Array = new Array();
			var six_ref:Array = new Array();
			var six_rel:Array = new Array();
			
			six_prim.push(PrimitiveType.LINE2 | PrimitiveType.LINE3, PrimitiveType.LOOP);
			
			six_ref.push(0,1,PrimitivePresets.RLT_FULL);
			
			six_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.COG,  ObjectDescriptor.HALF_TOP)));
			
			six_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 10, ObjectDescriptor.END_WESTERN)));
			
			six_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.BELOW, 10, ObjectDescriptor.END_WESTERN, ObjectDescriptor.MAX_TOP)));
			
			six_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST, 7, ObjectDescriptor.END_SOUTHERN, ObjectDescriptor.BODY)));
			
			six_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.WIDTH | SizeDescriptor.ABOUT_25, 3)));
			
			six = new ShapeModel(Character.SIX, six_prim, six_ref, six_rel, new Array(), name, false);
			
			return six;				
		}
		
		
		//---------------------------------------------------
		
		
		private static function getModel1():ShapeModel{
			var six:ShapeModel;
			var name:String = "MB_6_RND";
			var six_prim:Array = new Array();
			var six_ref:Array = new Array();
			var six_rel:Array = new Array();
			
			six_prim.push(PrimitiveType.CURVE_67, PrimitiveType.LOOP);
			
			six_ref.push(0,1,PrimitivePresets.RLT_FULL);
			
			six_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.COG,  ObjectDescriptor.HALF_TOP)));
			
			six_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 10, ObjectDescriptor.END_WESTERN)));
			
			six_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST_CLOSE, 10, ObjectDescriptor.BEGIN, ObjectDescriptor.BODY)));
			
			six_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.WIDTH | SizeDescriptor.ABOUT_25, 7)));
			
			six = new ShapeModel(Character.SIX, six_prim, six_ref, six_rel, new Array(), name, false);
			
			return six;				
		}
		
		
		//---------------------------------------------------
		
		
		private static function getModel2():ShapeModel{
			var six:ShapeModel;
			var name:String = "MB_6_HUMP";
			var six_prim:Array = new Array();
			var six_ref:Array = new Array();
			var six_rel:Array = new Array();
			
			six_prim.push(PrimitiveType.CURVE_70, PrimitiveType.LOOP);
			
			six_ref.push(0,1,PrimitivePresets.RLT_FULL);
			
			six_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.ABOVE, 10, ObjectDescriptor.COG,  ObjectDescriptor.HALF_TOP)));
			
			six_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.LOCATION, LocationDescriptor.LEFT, 10, ObjectDescriptor.END_WESTERN)));
			
			six_rel.push(new RelationDescription(0,1,new PrimitivesRelation(RelationDescriptorType.CONNECTION, ConnectionsDescriptor.EXIST_CLOSE, 10, ObjectDescriptor.BEGIN, ObjectDescriptor.BODY)));
			
			six_rel.push(new RelationDescription(1,2,new PrimitivesRelation(RelationDescriptorType.SIZE, SizeDescriptor.WIDTH | SizeDescriptor.ABOUT_25, 7)));
			
			six = new ShapeModel(Character.SIX, six_prim, six_ref, six_rel, new Array(), name, false);
			
			return six;				
		}
		
		
		//---------------------------------------------------
	}
}